<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>注册</title>
    </h:head>
    <h:body>
        <h:form>
            <h2>用户注册</h2>
            <h4>请提交注册信息</h4>
            <table>
                <tr>
                    <td>姓:</td>
                    <td>
                        <h:inputText label="First Name" 
                                     id="fname" value="#{userBean.firstName}" 
                                     required="true">
                            <f:validator validatorId="NameValidator"/>
                        </h:inputText>
                        <h:message for="fname" />
                    </td>
                </tr>
                <tr>
                    <td>名:</td>
                    <td>
                        <h:inputText label="Last Name"
                                     id="lname" value="#{userBean.lastName}"
                                     required="true"/>
                        <h:message for="lname" />
                    </td>
                </tr>
                <tr>
                    <td>性别:</td>
                    <td>
                        <h:selectOneRadio label="Sex" 
                                          id="sex" value="#{userBean.sex}" required="true">
                            <f:selectItem itemLabel="男" itemValue="男" />
                            <f:selectItem itemLabel="女" itemValue="女" />
                        </h:selectOneRadio>
                        <h:message for="sex" />
                    </td>
                </tr>
                <tr>
                    <td>出生日期:</td>
                    <td>
                        <h:inputText label="Date of Birth"
                                     id="dob" value="#{userBean.dob}" required="true">
                            <f:convertDateTime pattern="MM-dd-yy" />
                        </h:inputText> (mm-dd-yy)
                        <h:message for="dob" />
                    </td>
                </tr>

                <tr>
                    <td>邮箱地址:</td>
                    <td>
                        <h:inputText label="Email Address"
                                     id="email" value="#{userBean.email}" required="true"
                                     />
                        <h:message for="email" />
                    </td>
                </tr>
            </table>
            <p><h:commandLink value="注册" action="#{userBean.addUser}" actionListener="#{userBean.addUserListener}"  >
                <f:attribute name="userId" value="123"/>
                </h:commandLink>            
            </p>
        </h:form>
          <h:link value="登录" outcome="login"   >
                    <f:param name="name" value="hyl"/>
            </h:link>  
        <h:outputLink value="http://www.google.com.hk" >搜索一下</h:outputLink>
    </h:body>
</html>

